package com.sl.au.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 商户巡查实体信息
 * 
 * @author heguangchuan
 *
 */
@Entity
@Table(name = "sl_dcms_inspection")
public class BussinessInspection extends Root {

	// 社区巡查员
	@ManyToOne
	@JoinColumn(name = "userId")
	private User user;

	// 巡查时间
	private Date inspectDate;
	
	@Column(nullable = true)
	private double longitude;//经度
	
	@Column(nullable = true)
	private double latitude;//纬度

	// 巡查情况
	// private String inspectCondition;
	@ManyToOne
	@JoinColumn(name = "optionId")
	private Option inspectCondition;// 这个是 巡检状况

	// 备注 手动录入的巡检内容
	private String remark;

	// 图片地址
	private String pictureAddr;

	// 巡查的商家
	@ManyToOne
	@JoinColumn(name = "bussinessId")
	private BusinesssellerBaseInfo businesssellerBaseInfo;

	// 巡检的考核信息
	@ManyToOne(cascade = { CascadeType.MERGE })
	@JoinColumn(name = "checkId")
	private BussinessCheck check;

	@OneToMany(mappedBy = "inspection", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private Set<BusinessInspectDetail> details = new HashSet<>();

	private byte needCheck = 0;

	public byte getNeedCheck() {
		return needCheck;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public void setNeedCheck(byte needCheck) {
		this.needCheck = needCheck;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getInspectDate() {
		return inspectDate;
	}

	public void setInspectDate(Date inspectDate) {
		this.inspectDate = inspectDate;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public BusinesssellerBaseInfo getBusinesssellerBaseInfo() {
		return businesssellerBaseInfo;
	}

	public void setBusinesssellerBaseInfo(BusinesssellerBaseInfo businesssellerBaseInfo) {
		this.businesssellerBaseInfo = businesssellerBaseInfo;
	}

	public String getPictureAddr() {
		return pictureAddr;
	}

	public Set<BusinessInspectDetail> getDetails() {
		return details;
	}

	public void setDetails(Set<BusinessInspectDetail> details) {
		this.details = details;
	}

	public void setPictureAddr(String pictureAddr) {
		this.pictureAddr = pictureAddr;
	}

	public Option getInspectCondition() {
		return inspectCondition;
	}

	public void setInspectCondition(Option inspectCondition) {
		this.inspectCondition = inspectCondition;
	}

	public BussinessCheck getCheck() {
		return check;
	}

	public void setCheck(BussinessCheck check) {
		this.check = check;
	}

}
